// 三级导航接口函数

// 0.引人axios异步对象
import request from '@/utils/request'
import type { categoryInfoListModel } from './model/categorySelectorModel'

// 1.使用枚举定义接口
enum Api {
  getCategory1ListApi = '/admin/product/getCategory1',
  getCategory2ListApi = '/admin/product/getCategory2',
  getCategory3ListApi = '/admin/product/getCategory3',
}

// 2.获取一级分类的接口函数
export const reqGetCategory1ListData = () => {
  return request.get<any, categoryInfoListModel>(`${Api.getCategory1ListApi}`)
}

// 3. 获取二级分类数据的接口函数
export const reqGetCategory2ListData = (category1Id: number) => {
  return request.get<any, categoryInfoListModel>(`${Api.getCategory2ListApi}/${category1Id}`)
}

// 4. 获取三级分类数据的接口函数
export const reqGetCategory3ListData = (category2Id: number) => {
  return request.get<any, categoryInfoListModel>(`${Api.getCategory3ListApi}/${category2Id}`)
}